<div class="problemindexholder" problemindex="A">
 <div class="ttypography">
  <div class="problem-statement">
   <div class="header">
    <div class="title">
     A. Karen and Morning
    </div>
    <div class="time-limit">
     <div class="property-title">
      time limit per test
     </div>
     2 seconds
    </div>
    <div class="memory-limit">
     <div class="property-title">
      memory limit per test
     </div>
     512 megabytes
    </div>
    <div class="input-file">
     <div class="property-title">
      input
     </div>
     standard input
    </div>
    <div class="output-file">
     <div class="property-title">
      output
     </div>
     standard output
    </div>
   </div>
   <div>
    <p>
     Karen is getting ready for a new school day!
    </p>
    <center>
     <img class="tex-graphics" src="/predownloaded/10/10/101006b28ff0912f16c1d39e67206ca4b0b6da23.png" style="max-width: 100.0%;max-height: 100.0%;"/>
    </center>
    <p>
     It is currently
     <span class="tex-font-style-tt">
      hh:mm
     </span>
     , given in a 24-hour format. As you know, Karen loves
     <span class="tex-font-style-it">
      palindromes
     </span>
     , and she believes that it is good luck to wake up when the time is a palindrome.
    </p>
    <p>
     What is the minimum number of minutes she should sleep, such that, when she wakes up, the time is a palindrome?
    </p>
    <p>
     Remember that a palindrome is a string that reads the same forwards and backwards. For instance,
     <span class="tex-font-style-tt">
      05:39
     </span>
     is not a palindrome, because
     <span class="tex-font-style-tt">
      05:39
     </span>
     backwards is
     <span class="tex-font-style-tt">
      93:50
     </span>
     . On the other hand,
     <span class="tex-font-style-tt">
      05:50
     </span>
     is a palindrome, because
     <span class="tex-font-style-tt">
      05:50
     </span>
     backwards is
     <span class="tex-font-style-tt">
      05:50
     </span>
     .
    </p>
   </div>
   <div class="input-specification">
    <div class="section-title">
     Input
    </div>
    <p>
     The first and only line of input contains a single string in the format
     <span class="tex-font-style-tt">
      hh:mm
     </span>
     (
     <span class="tex-span">
      00 ≤
     </span>
     <span class="tex-font-style-tt">
      hh
     </span>
     <span class="tex-span">
      ≤ 23
     </span>
     ,
     <span class="tex-span">
      00 ≤
     </span>
     <span class="tex-font-style-tt">
      mm
     </span>
     <span class="tex-span">
      ≤ 59
     </span>
     ).
    </p>
   </div>
   <div class="output-specification">
    <div class="section-title">
     Output
    </div>
    <p>
     Output a single integer on a line by itself, the minimum number of minutes she should sleep, such that, when she wakes up, the time is a palindrome.
    </p>
   </div>
   <div class="sample-tests">
    <div class="section-title">
     Examples
    </div>
    <div class="sample-test">
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>05:39<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>11<br/></pre>
     </div>
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>13:31<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>0<br/></pre>
     </div>
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>23:59<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>1<br/></pre>
     </div>
    </div>
   </div>
   <div class="note">
    <div class="section-title">
     Note
    </div>
    <p>
     In the first test case, the minimum number of minutes Karen should sleep for is
     <span class="tex-span">
      11
     </span>
     . She can wake up at
     <span class="tex-font-style-tt">
      05:50
     </span>
     , when the time is a palindrome.
    </p>
    <p>
     In the second test case, Karen can wake up immediately, as the current time,
     <span class="tex-font-style-tt">
      13:31
     </span>
     , is already a palindrome.
    </p>
    <p>
     In the third test case, the minimum number of minutes Karen should sleep for is
     <span class="tex-span">
      1
     </span>
     minute. She can wake up at
     <span class="tex-font-style-tt">
      00:00
     </span>
     , when the time is a palindrome.
    </p>
   </div>
  </div>
  <p>
  </p>
 </div>
</div>
